<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let obj = {a: 10, b: 20}
    // console.log(obj.a); // 10
    // console.log(obj[a]); //  报错  对象[变量]  [] 不加引号 会被解析成一个变量
    // console.log(obj['a']); // 10
    for(let k in obj) {
      console.log(k) // a  b 
      console.log(obj[k]) // 10  20
    }
  </script>
</body>
</html>